package StatePattern.example1;

public class LowScoreState implements ScoreState {
    private static LowScoreState singleton = new LowScoreState();

    LowScoreState() {

    }

    public static ScoreState getInstance() {
        return singleton;
    }

    @Override
    public String getStateName() {
        return "不及格";
    }

    @Override
    public void setScore(ScoreContext scoreContext, int score) {
        if (score >= 60 && score < 80) {
            scoreContext.changeState(MidScoreState.getInstance());
        } else if (score >= 80) {
            scoreContext.changeState(HighScoreState.getInstance());
        }
    }
}
